import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'

import axios from "axios"

// 引入全局样式
import './assets/css/global.css'
import './assets/fonts/iconfont.css'

Vue.config.productionTip = false

// 配置axios全局变量 URL
axios.defaults.baseURL = "http://127.0.0.1:8888/api/private/v1/"
// 配置axios拦截器，在每次发送请求前都设置一个请求头Authorization
axios.interceptors.request.use(function (config) {
  config.headers.Authorization = window.sessionStorage.getItem("token");
  // console.log('config', config)
  return config
})
//  配置axios
Vue.prototype.$http = axios

new Vue({
  router,
  render: h => h(App),
  mounted() {
    window.vue = this
  }
}).$mount('#app')
